<template>
  <div class="card-container">
    <a :href="link" target="_blank" class="itemLink" :title="title">
      <div class="card_img">
        <img :src="imgLink" />
        <div class="img_mask">
          <div class="img_info">
            <div class="info_left">
              <span class="play_count">
                <IconSvg iconClass="icon-bofangliang"></IconSvg>
                <span class="count_text">{{ play_count }}</span>
              </span>
            </div>
            <div class="info_right">{{ star_count }}追番</div>
          </div>
        </div>
      </div>
      <div class="card_info">
        <h3 class="card_title">{{ title }}</h3>
        <p class="card_description">{{ description }}</p>
      </div>
    </a>
  </div>
</template>

<script>
import IconSvg from '@/components/IconSvg';
export default {
  name: 'Card',
  components: {
    IconSvg
  },
  props: {
    // 链接
    link: {
      default: 'javascript:;',
      type: String
    },
    // 图片地址
    imgLink: {
      default:
        'https://i0.hdslb.com/bfs/archive/388df22979f120b8031cc853112756ec0b803e69.jpg@672w_378h_1c.webp',
      type: String
    },
    // 播放量
    play_count: {
      default: '0',
      type: String
    },
    // 追番人数
    star_count: {
      default: '0',
      type: String
    },
    // 标题
    title: {
      default: '标题标题',
      type: String
    },
    // 描述信息
    description: {
      default: '',
      type: String
    }
  }
};
</script>

<style lang="less" scoped>
.card-container {
  min-width: 0;
  .itemLink {
    width: 100%;
    height: 100%;
    display: inline-block;
    .card_img {
      border-radius: 6px;
      position: relative;
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 6px;
      }
      .img_mask {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        .img_info {
          position: absolute;
          left: 0;
          bottom: 0;
          height: 38px;
          width: 100%;
          padding: 16px 8px 6px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          color: #fff;
          box-sizing: border-box;
          font-size: 1.3rem;
          line-height: 18px;
          background-image: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.5) 100%
          );
          z-index: 2;
          border-bottom-left-radius: 8px;
          border-bottom-right-radius: 8px;
        }
        .icon-bofangliang {
          line-height: 18px;
        }
        .count_text {
          margin-left: 10px;
        }
      }
    }
    .card_info {
      margin-top: 10px;
      .card_title {
        font-size: 1.5rem;
        color: #18191c;
        padding-right: 24px;
        line-height: 22px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition: color 0.2s linear;
        &:hover {
          color: #00aeec;
        }
      }
      .card_description {
        margin-top: 4px;
        font-size: 1.3rem;
        line-height: 16px;
        color: #9499a0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}
</style>
